﻿<%@ Page Language="C#" MasterPageFile="~/Admin/AdminMasterPage.master" AutoEventWireup="true"
    ValidateRequest="false" CodeFile="LearnObjs.aspx.cs" Inherits="Admin_LearnObjs"
    Title="Admin Page - Information Literacy Education" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Register TagPrefix="uc" TagName="UpdateProgress" Src="~/UserControls/UpdateProgress.ascx" %>
<%@ Register TagPrefix="uc" TagName="ModalPopupMessage" Src="~/UserControls/ModalPopupMessage.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="Server">
    <uc:UpdateProgress ID="updateProgress" runat="server" />
    <%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>--%>
    <uc:ModalPopupMessage ID="ModalPopupMessage" runat="server" />
    <h1>
        Manage Learning Objects</h1>
    <br />
    <asp:Button ID="btnOpenCreateLearnObj" runat="server" Text="Create Learning Object"
        Width="200" OnClick="btnOpenCreateLearnObj_Click" />
    &nbsp;&nbsp;&nbsp;
    <asp:Button ID="btnOpenEditLearnObj" runat="server" Text="Edit Learning Object" Width="200"
        OnClick="btnOpenEditLearnObj_Click" />
    <br />
    <br />
    <asp:MultiView ID="MultiViewLearnObj" runat="server">
        <asp:View ID="ViewEditLearnObj" runat="server">
            <h2>
                Edit Learning Object</h2>
            <div class="indent20" style="min-width: 600px;">
                <span class="fieldLabels">Learning Object Standards :</span><asp:DropDownList ID="ddlistStandards"
                    runat="server" OnSelectedIndexChanged="ddlistStandards_SelectedIndexChanged"
                    AutoPostBack="True" />
                <br />
                <br />
                <asp:Panel ID="PanelLearnObjsList" runat="server">
                    <h3>
                        List of Learning Objects</h3>
                    <asp:GridView ID="GridViewLearnObjs" runat="server" AllowPaging="True" AllowSorting="True"
                        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="LearnObjID,StandardID"
                        DataSourceID="datasrcLearnObjs" ForeColor="#333333" GridLines="None" Width="600px"
                        OnDataBound="GridViewLearnObjs_DataBound" OnSelectedIndexChanged="GridViewLearnObjs_SelectedIndexChanged"
                        PageSize="25">
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <Columns>
                            <asp:CommandField ShowSelectButton="True" />
                            <asp:BoundField DataField="Title" HeaderText="Learning Object Title" SortExpression="Title" />
                            <asp:BoundField DataField="LastUpdateDateTime" HeaderText="Last Update" SortExpression="LastUpdateDateTime">
                            </asp:BoundField>
                        </Columns>
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#999999" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    </asp:GridView>
                    <asp:ObjectDataSource ID="datasrcLearnObjs" runat="server" OldValuesParameterFormatString="original_{0}"
                        SelectMethod="GetLearnObjsByStandardID" TypeName="LearnObjsBLL" UpdateMethod="UpdateLearnObj">
                        <UpdateParameters>
                            <asp:Parameter Name="title" Type="String" />
                            <asp:Parameter Name="link" Type="String" />
                            <asp:Parameter Name="estimatedTime" Type="String" />
                            <asp:Parameter Name="directions" Type="String" />
                            <asp:Parameter Name="learnObjQuizQuestions" Type="String" />
                            <asp:Parameter Name="LearnObjID" Type="Int32" />
                        </UpdateParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="ddlistStandards" Name="standardID" PropertyName="SelectedValue"
                                Type="Int32" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                    <asp:Panel ID="PanelEmptyLearnObjMessage" runat="server" Visible="false">
                        <div style="text-align: center;">
                            <h4>
                                No Learning Objects Available.</h4>
                        </div>
                    </asp:Panel>
                    <br />
                    <asp:Panel ID="PanelLearnObjDetail" runat="server" Visible="false">
                        <h4>
                            Learning Object Details
                        </h4>
                        <br />
                        <table>
                            <tr>
                                <td class="tableLeftHeader">
                                    Learning Object Title * :
                                </td>
                                <td class="tableItem">
                                    <asp:TextBox ID="txtEditLearnObjTitle" runat="server" Width="250" MaxLength="100" />
                                    <asp:RequiredFieldValidator ID="rfvEditLearnObjTitle" runat="server" ErrorMessage="* Learning Object Title is required"
                                        ControlToValidate="txtEditLearnObjTitle" ValidationGroup="EditLearnObj" />
                                </td>
                            </tr>
                            <tr>
                                <td class="tableLeftHeader">
                                    Internal Learning Object? :
                                </td>
                                <td class="tableItem">
                                    <asp:CheckBox ID="chkboxEditLearnObjIsInternal" runat="server" AutoPostBack="true"
                                        OnCheckedChanged="chkboxEditLearnObjIsInternal_CheckedChanged" />
                                </td>
                            </tr>
                            <tr>
                                <td class="tableLeftHeader">
                                    LearnObj External Link (URL) * :
                                </td>
                                <td class="tableItem">
                                    <%-- *TODO --%>
                                    <asp:TextBox ID="txtEditLearnObjLink" runat="server" Width="180" MaxLength="150" />
                                    &nbsp;e.g.) http://www.wsu.edu/
                                    <asp:RegularExpressionValidator ID="revEditLearnObjLink" runat="server" ErrorMessage="* Please put a vaild URL."
                                        ControlToValidate="txtEditLearnObjLink" SetFocusOnError="true" ValidationGroup="EditLearnObj"
                                        ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%#&amp;=]*)?" Display="Dynamic" />
                                    <asp:RequiredFieldValidator ID="rfvEditLearnObjLink" runat="server" ControlToValidate="txtEditLearnObjLink"
                                        ValidationGroup="EditLearnObj" ErrorMessage="* LearnObj Link is required." Display="Dynamic" />
                                </td>
                            </tr>
                            <tr>
                                <td class="tableLeftHeader">
                                    Upload Files :
                                </td>
                                <td class="tableItem">
                                    <asp:FileUpload ID="FileEditUploadLearnObj" runat="server" />&nbsp;
                                    <asp:Button ID="btnEditUploadFile" runat="server" Text="Upload" OnClick="btnEditUploadFile_Click" /><br />
                                    <asp:Label ID="lblEditUploadedFile" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="tableLeftHeader">
                                    Applicable Standards * :
                                </td>
                                <td class="tableItem">
                                    <asp:ListBox ID="lstboxEditStandards" runat="server" SelectionMode="Multiple" />
                                    <asp:RequiredFieldValidator ID="rfvEditStandard" runat="server" ErrorMessage="* Please choose at least one Standard"
                                        ControlToValidate="lstboxEditStandards" ValidationGroup="EditLearnObj" />
                                </td>
                            </tr>
                            <tr>
                                <td class="tableLeftHeader">
                                    Estimated Time :
                                </td>
                                <td class="tableItem">
                                    <asp:TextBox ID="txtEditEstimatedTime" runat="server" Width="100" MaxLength="20" />
                                    &nbsp;e.g.) ~ 10 minutes
                                </td>
                            </tr>
                            <tr>
                                <td class="tableLeftHeader">
                                    Directions :
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <FCKeditorV2:FCKeditor ID="txtEditDirections" runat="server" BasePath="~/fckeditor/"
                                        ToolbarSet="ILE_Admin" HtmlEncodeOutput="false" Width="600" Height="350">
                                    </FCKeditorV2:FCKeditor>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="text-align: center;">
                                    <asp:Button ID="btnEditLearnObj" runat="server" Text="Update Learning Object" Width="200"
                                        OnClick="btnEditLearnObj_Click" ValidationGroup="EditLearnObj" />
                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                    <asp:Button ID="btnManageLearnObjQuestions" runat="server" Text="Manage Quiz Questions"
                                        Width="200" OnClick="btnManageLearnObjQuestions_Click" />
                                    <br />
                                    <br />
                                    <asp:Button ID="btnDeleteLearnObj" runat="server" Text="Delete Learning Object" OnClick="btnDeleteLearnObj_Click" />
                                    <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="btnDeleteLearnObj"
                                        ConfirmText="Are you sure you want to delete the Learning Object?" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </asp:Panel>
            </div>
        </asp:View>
        <asp:View ID="ViewCreateLearnObj" runat="server">
            <h2>
                Create Learning Object</h2>
             <div class="indent20" style="min-width: 600px;">
                <table>
                    <tr>
                        <td class="tableLeftHeader" style="width: 180px;">
                            Learning Object Title * :
                        </td>
                        <td class="tableItem">
                            <asp:TextBox ID="txtLearnObjTitle" runat="server" Width="250" MaxLength="100" />
                            <asp:RequiredFieldValidator ID="rfvLearnObjTitle" runat="server" ErrorMessage="* Learning Object Title is required"
                                ControlToValidate="txtLearnObjTitle" ValidationGroup="CreateLearnObj" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tableLeftHeader">
                            Internal Learning Object? :
                        </td>
                        <td class="tableItem">
                            <asp:CheckBox ID="chkboxLearnObjIsInternal" runat="server" AutoPostBack="true" OnCheckedChanged="chkboxLearnObjIsInternal_CheckedChanged" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tableLeftHeader">
                            Learning Object Link (URL) * :
                        </td>
                        <td class="tableItem">
                            <asp:TextBox ID="txtLearnObjLink" runat="server" Width="200" Text="http://" MaxLength="150" />
                            &nbsp;e.g.) http://www.wsu.edu/
                            <asp:RegularExpressionValidator ID="revLearnObjLink" runat="server" ErrorMessage="<br />* Please put a vaild URL."
                                ControlToValidate="txtLearnObjLink" SetFocusOnError="true" ValidationGroup="CreateLearnObj"
                                ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%#&amp;=]*)?" Display="Dynamic" />
                            <asp:RequiredFieldValidator ID="rfvLearnObjLink" runat="server" ControlToValidate="txtLearnObjLink"
                                ValidationGroup="CreateLearnObj" ErrorMessage="<br />* Learning Object Link is required."
                                Display="Dynamic" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tableLeftHeader">
                            Upload Files :
                        </td>
                        <td class="tableItem">
                            <asp:FileUpload ID="FileUploadLearnObj" runat="server" />&nbsp;
                            <asp:Button ID="btnUploadFile" runat="server" Text="Upload" OnClick="btnUploadFile_Click" /><br />
                            <asp:Label ID="lblUploadedFile" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td class="tableLeftHeader">
                            Applicable Standards * :
                        </td>
                        <td class="tableItem">
                            <asp:ListBox ID="lstboxStandards" runat="server" SelectionMode="Multiple" />
                            <asp:RequiredFieldValidator ID="rfvStandards" runat="server" ErrorMessage="* Please choose at least one Standard"
                                ControlToValidate="lstboxStandards" ValidationGroup="CreateLearnObj" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tableLeftHeader">
                            Estimated Time :
                        </td>
                        <td class="tableItem">
                            <asp:TextBox ID="txtEstimatedTime" runat="server" Width="100" MaxLength="20" />
                            &nbsp;e.g.) ~ 10 minutes
                        </td>
                    </tr>
                    <tr>
                        <td class="tableLeftHeader">
                            Instructions :
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <FCKeditorV2:FCKeditor ID="txtDirections" runat="server" BasePath="~/fckeditor/"
                                ToolbarSet="ILE_Admin" HtmlEncodeOutput="false" Width="600" Height="350">
                            </FCKeditorV2:FCKeditor>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                            <asp:Button ID="btnCreateLearnObj" runat="server" Text="Create Learning Object" Width="200"
                                OnClick="btnCreateLearnObj_Click" ValidationGroup="CreateLearnObj" />
                        </td>
                    </tr>
                </table>
            </div>
        </asp:View>
    </asp:MultiView>
    <%-- </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnEditLearnObj" />
            <asp:PostBackTrigger ControlID="btnCreateLearnObj" />
        </Triggers>
    </asp:UpdatePanel>--%>
</asp:Content>
